<template>
	<div class="center">
		<view class="center_top">
			<view class="moban"></view>
			<view class="base">
				<view class="profily_header">
					<image :src="avatar" mode="" class="images_"></image>
				</view>
				<text>{{usernickname}}</text>
			</view>
		</view>
		<view class="Navigation">
			<view class="Navigation_content" v-for="item in dataarr" @click="bidfn(item)">
				<image :src="item.url"></image>
				<view>{{item.name}}</view>
			</view>
		</view>
		<view class="service_">
			<view class="Under_">线下服务站点</view>
			<doctormap :doctor="doctor"></doctormap>
		</view>
		<denglu :popups="popups"  @giveadvice="giveadviceFN" @userdelu='userDeLu'></denglu>
	</div>
</template>
<script>
	import doctormap from "@/components/service/doctormap.vue"
	import dog_7 from '@/static/dog/7.jpg'
	import bangdingkehu from '@/static/service/bangdingkehu.png' 
	import dailizhinan from '@/static/service/dailizhinan.png'
	import dingdanguanli from '@/static/service/dingdanguanli.png'
	import shiyongzhinan from '@/static/service/shiyongzhinan.png'
	import gerenzhongxin from '@/static/service/gerenzhongxin.png'
	import wodetuiguangshang from '@/static/service/wodetuiguangshang.png'
	import xianxiashanghutuiguangruzhu from '@/static/service/xianxiashanghutuiguangruzhu.png'
	import fapiaoguanli from '@/static/service/fapiaoguanli.png'
	import icon_ from '@/static/service/icon_.png'
	import denglu from "@/components/ah-denglu/denglu.vue"
	import mykcy from '@/static/mykcy.jpg'
	export default {
		props: {},
		components: {
			doctormap,
			denglu
		},
		data() {
			return {
				popups:{
					bannerShow:false
				},
				popup:false,
				usernickname:'绵州犬管欢迎您的参与',
				avatar:mykcy,
				dataarr: [{
						'name': '申办犬证',
						'url': bangdingkehu,
						'address': './bidfor/bidtwo',
						'type':'0',
					}, {
						'name': '电子犬证',
						'url': wodetuiguangshang,
						'address': '../mypage/le_dogcard/dogcard',
						'type':'0',
					}, {
						'name': '进度查询',
						'url': shiyongzhinan,
						'address': 'process/process',
						'type':'0',
					}, {
						'name': '养犬时事',
						'url': dingdanguanli,
						'address': './canine/canine',
						'type':'1',
					}, 
		
					{
						'name': '宠物领养',
						'url': xianxiashanghutuiguangruzhu,
						'address': '../mypage/le_file/loss?val=3',
						'type':'2',

					}, {
						'name': '办理流程',
						'url': dailizhinan,
						'address': '../mypage/le_dogcard/process',
						'type':'2',
					},
					{
						'name': '执法记录',
						'url': icon_,
						'address': 'law/law',
						'type':'2',

					}
				],
				doctor: [{
						'name': '皮卡丘宠物诊所',
						'address': '中共中央四川绵阳园艺山B-215',
						'time': "09：00-20：00（周一至周五）"
					},
					{
						'name': '卡布达宠物诊所',
						'address': '中共中央四川绵阳园艺山科创园区',
						'time': "09：00-20：00（周一至周五）"
					},
					{
						'name': '皮皮虾宠物诊所',
						'address': '中共中央四川绵阳园艺山下....暂未开业',
						'time': "09：00-20：00（周一至周五）"
					},
				],
				text:{},
				QuickLogintext:{},
				itemaddress:'',//记录点击地址
			}
		},
		methods: {
			bidfn(item) {
				this.itemaddress = item.address;
				console.log(item.address)
				if(this.popup == true){
				 switch(item.type){
					 case '0':  //验证
					 this.popups.bannerShow = true;
					 break;
					 case '1': //通过
					 uni.navigateTo({
					 	"url": item.address,
					 });
					 break;
					 case '2': //未开通
					 uni.showToast({
					     title: '正在开发中',
					 	  icon:'none',
					     duration: 2000
					 });
					 break;
				 }
				}
				else{
					// console.log(item.address)
			switch(item.type){
								 case '0':  //验证
								uni.navigateTo({
									"url": item.address,
								});
								 break;
								 case '1': //通过
								 uni.navigateTo({
								 	"url": item.address,
								 });
								 break;
								 case '2': //未开通
								 uni.showToast({
								     title: '正在开发中',
								 	  icon:'none',
								     duration: 2000
								 });
								 break;
			}
				}
			},
			giveadviceFN(active){
					this.popups.bannerShow = false;
			},
			userDeLu(active){   //用户登陆注册后的事
				this.popup = false;
				this.avatar = active.wx.avatar;
				this.usernickname = active.wx.nickname;
				uni.navigateTo({
					"url": this.itemaddress,
				});
				
			}
		},
		watch: {},

		onReachBottom() { //页面上拉触底事件的处理函数

		},
		onPullDownRefresh() { //监听用户下拉动作，一般用于下拉刷新
			//需要在 pages.json 里，找到的当前页面的pages节点，并在 style 选项中开启 enablePullDownRefresh
			//uni.startPullDownRefresh(); 开启
			// uni.stopPullDownRefresh(); 关闭
		},
		onUnload() { //监听页面卸载

		},
		onHide() { //监听页面隐藏

		},
		onLoad() { // 替代 created 监听页面加载，其参数为上个页面传递的数据，参数类型为Object（用于页面传参），参考示例
			// console.log(option)
		},
		created(){
		uni.setStorageSync('SWITCH',false)
		},
		onReady() { //替代 mounted 监听页面初次渲染完成
		this.$apifn.QuickLogin({}).then((res)=>{
			this.avatar = res.data.Response.data.wx.avatar;
			this.usernickname = res.data.Response.data.wx.nickname;
			this.QuickLogintext = res.data.Response.data.wx;
			 if(res.data.Response.code == 200){
				uni.setStorageSync('refresh_token', res.data.Response.data.refresh_token);
				uni.setStorageSync('USERINFO', res.data.Response.data);
				uni.setStorageSync('SWITCH',false);
			 }
		 }).catch((ret)=>{ 
			 this.QuickLogintext = ret
			  if(ret.data){
				  this.popup = true;  //开关 true 打开 false 关闭
			  }
		});
		},
		onShow() { //监听页面显示
			//生命周期
			
		}
	}
</script>
<style lang="scss" scoped>
	.center {
		height: 100%;
		height: 370upx;
		    position: relative;
		    top: -20px;

		&_top {
			z-index: 888;
			width: 100%;
			height: 370upx;
			background-size: cover;
			background-image: url('../../static/bg.jpg');
			background-size: 100%;
			/* Old browsers */
		}
	}

	.moban {
		width: 100%;
		height: 200upx;
	}

	.base {
		display: flex;
		align-items: center;
		width: 88%;
		margin: auto;
		.profily_header {
			height: 100upx;
			width: 100upx;
			background-size: 100% 100%;
			.images_{
				background-size:100% 100%;
				height: 100%;
				width: 100%;
				border-radius: 8px;
			}
		}

		text {
			margin-left: 20px;
			font-size: 30upx;
			color: white;
			font-size: 15px
		}
	}

	//导航
	.Navigation {
		width: 100%;
		height: 350upx;
		background: white;

		.Navigation_content {
			width: 25%;
			float: left;
			height: 85px;

			image {
				height: 80upx;
				width: 45%;
				margin-left: 25%;
				margin-top: 20upx;
				background-size: 100% 100%;
			}

			view {
				text-align: center;
			}
		}
	}

	//线下服务站点
	.service_ {
		width: 100%;
		margin-top: 15upx;
		background: white;

		.Under_ {
			width: 90%;
			margin: auto;
			height: 60upx;
			border-bottom: 1px solid #F4F5F6;
			line-height: 60upx;
			font-weight: bolder;
			color: #484848;
		}
	}
</style>
